package com.cxy.entity;

import java.util.Set;

import javax.persistence.*;

/**
 * 用户实体
 * @author h
 *
 */
@Entity
@Table(name = "sys_user")
public class SysUser extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 103889943178214590L;

	@Column(name = "user_name", unique = true, nullable = false)
	private String userName; // 用户名
	@Column(name = "user_password")
	private String userPassword; // 密码
	@ManyToMany(cascade = CascadeType.ALL,fetch=FetchType.LAZY)
	@JoinTable(name = "sys_user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
	private Set<SysRole> user_role; // 所属角色
	@Column(name = "user_telephone")
	private String userTelephone; // 电话
	@Column(name = "user_create_date")
	private String createDate; // 创建日期
	@Column(name = "user_lottery_num", columnDefinition = "int default 1")
	private Integer lotteryNum; // 抽奖次数（默认一次）
    @OneToOne  
    @JoinColumn(name="award_id")
	private SysAward award;
	

	public SysUser() {

	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserPassword() {
		return userPassword;
	}

	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}

	public String getUserTelephone() {
		return userTelephone;
	}

	public void setUserTelephone(String userTelephone) {
		this.userTelephone = userTelephone;
	}

	public Integer getLotteryNum() {
		return lotteryNum;
	}

	public void setLotteryNum(Integer lotteryNum) {
		this.lotteryNum = lotteryNum;
	}

	public String getCreateDate() {
		return createDate;
	}

	public void setCreateDate(String createDate) {
		this.createDate = createDate;
	}

	public Set<SysRole> getUser_role() {
		return user_role;
	}

	public void setUser_role(Set<SysRole> user_role) {
		this.user_role = user_role;
	}

	public SysAward getAward() {
		return award;
	}

	public void setAward(SysAward award) {
		this.award = award;
	}

}
